package com.aaa.hospital.controller;

import com.aaa.hospital.pojo.domain.Dept;
import com.aaa.hospital.pojo.query.DeptQuery;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: HJT
 * @DateTime: 2022/1/15 12:01
 * @Description: TODO
 */
@RestController
@RequestMapping("dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @RequestMapping("list")
    public AjaxResult list(){
        return deptService.list();
    }

    @RequestMapping("query")
    public AjaxResult query(DeptQuery query) {

        return deptService.queryDept(query);
    }

    @RequestMapping("add")
    public AjaxResult add(Dept dept) {

        return deptService.addDept(dept);
    }

    @RequestMapping("delete/{id}")
    public AjaxResult delete(@PathVariable("id") Integer id) {

        return deptService.deleteDept(id);
    }

    @RequestMapping("get/{id}")
    public AjaxResult get(@PathVariable("id") Integer id) {

        return deptService.getDept(id);
    }

    @RequestMapping("update")
    public AjaxResult update(Dept dept) {

        return deptService.updateDept(dept);
    }


}
